<?php

require "conn.php";



if(isset($_POST['user'])){
    $user=$_POST['user'];
    $result=$conn->query("select * from usertable where username='$user'");
    if($result->fetch_assoc()){
        echo true;
    }else {
        echo '2';
    }
}


if(isset($_POST['submit'])){
    $user=$_POST['user'];
    $pass=$_POST['pass'];
    $tel=$_POST['tel'];
    $conn->query("insert usertable values(null,'$user','$pass','$tel')");
    header('location:http://10.31.158.42/javascript/projectname/src/login.html');
}